package com.wwmz.visitor.pattern;

import com.wwmz.visitor.pattern.kpi.Employee;
import com.wwmz.visitor.pattern.kpi.Engineer;
import com.wwmz.visitor.pattern.kpi.Manager;

/**
 * Created by wumz on 2020/9/24 17:51
 */
public class ReportUtil {
    public void visit(Employee employee){
        if (employee instanceof Manager){
            Manager manager = (Manager) employee;
            System.out.println("经理：" + manager.name+ "， KPI:" + manager.kpi + ", 新产品数量：" + manager.getProducts());
        }
        if (employee instanceof Engineer){
            //...
        }
    }
}
